﻿using System;
using System.Collections.Generic;
using System.Text;

namespace TouchPoint.Foundation
{
    /// <summary>
    /// 表示一个操作堆栈，该堆栈为项目提供撤销与重做功能支撑
    /// </summary>
    public sealed class OperationStack
    {
        LimitedStack<IOperationUnit> _undoStack;
        LimitedStack<IOperationUnit> _redoStack;

        public OperationStack()
        {
            _undoStack = new LimitedStack<IOperationUnit>();
            _redoStack = new LimitedStack<IOperationUnit>();
        }

        #region Property

        public IEnumerator<IOperationUnit> RedoEnumerator {
            get {
                return _redoStack.GetEnumerator();
            }
        }

        public IEnumerator<IOperationUnit> UndoEnumerator {
            get {
                return _undoStack.GetEnumerator();
            }
        }

        public int RedoLimit { get; set; } = 100;

        public int UndoLimit { get; set; } = 100;

        #endregion
    }
}
